# -*- coding: utf-8 -*-
# @Time    : 2021/8/31 11:04
# @Author  : BrandonGT
# @FileName: 05_PyQt5_QAbstractButton_状态.py

# 1. 导入包和模块
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
import sys

# 2. 创建一个应用程序对象
app = QApplication(sys.argv)

# 3. 创建控件
window = QWidget()

# 3.1 设置控件
window.setWindowTitle("")
window.resize(500, 500)

# 3.1.1 创建子控件
push_btn = QPushButton(window)
push_btn.resize(150, 25)
push_btn.setText("PushButton")
push_btn.move(200, 10)

radio_btn = QRadioButton(window)
radio_btn.resize(150, 25)
radio_btn.setText("RadioButton")
radio_btn.move(200, 50)

check_btn = QCheckBox(window)
check_btn.resize(150, 25)
check_btn.setText("CheckButton")
check_btn.move(200, 100)

# 3.1.2 设置子控件
push_btn.setDown(True)
push_btn.setCheckable(True)
push_btn.setStyleSheet("QPushButton:pressed {background-color: red;}")

print(radio_btn.isCheckable())
radio_btn.setChecked(True)

# 3.2 展示控件
window.show()

# 4. 应用程序执行，进入消息循环
sys.exit(app.exec_())